package com.gxa.controller.xiaohuocontroller;

import com.gxa.common.R;
import com.gxa.pojo.KeHuDingDan;
import com.gxa.service.xiaohuoservice.KeHuDingDanService;
import io.swagger.annotations.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

/**
 * @version 1.0
 * @Author fluoxetine
 * @Date 2022/3/31 10:42
 **/
@RestController
@RequestMapping("/XiaoHuo/keHuDingDanJiLu")
@Api(value = "销货管理" , tags = "客户订单记录数据接口API")
@RequiresPermissions("客户订单记录")
public class KeHuDingDanJiLuController {
    @Autowired
    private KeHuDingDanService keHuDingDanService;

    @RequestMapping(value = "/selectKeHuDingDanJiLu", method = RequestMethod.GET)
    @ApiOperation(value = "客户订单记录查询接口", notes = "提供当前页码数与每页显示条数", httpMethod = "get", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "keHuName", value = "客户名", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "startTime", value = "开始日期，默认当月1号", required = false, dataType = "date", paramType = "query"),
            @ApiImplicitParam(name = "endTime", value = "结束日期，默认当月最后一天", required = false, dataType = "date", paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "请求成功"),
            @ApiResponse(code = 404, message = "找不到页面"),
            @ApiResponse(code = 500, message = "后台服务器错误")
    })
    public R selectKeHuDingDanJiLu(String keHuName, String startTime, String endTime) {
        return keHuDingDanService.selectKeHuDingDanJiLu(keHuName, startTime,endTime);
    }

    @RequestMapping(value = "/shenHe", method = RequestMethod.POST)
    @ApiOperation(value = "客户订单记录审核接口", notes = "提供当前页码数与每页显示条数", httpMethod = "post", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shenHeRen", value = "shenHeRen", required = true, dataType = "int", paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "请求成功"),
            @ApiResponse(code = 404, message = "找不到页面"),
            @ApiResponse(code = 500, message = "后台服务器错误")
    })
    public R shenHe(@RequestParam int  shenHeZhuangTai){
        return keHuDingDanService.shenHe(shenHeZhuangTai);
    }

    @RequestMapping(value = "/fanShenHe", method = RequestMethod.POST)
    @ApiOperation(value = "客户订单记录反审核接口", notes = "提供当前页码数与每页显示条数", httpMethod = "post", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shenHeZhuangTai", value = "客户订单反审核", required = true, dataType = "int", paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "请求成功"),
            @ApiResponse(code = 404, message = "找不到页面"),
            @ApiResponse(code = 500, message = "后台服务器错误")
    })
    public R fanShenHe(@RequestParam int shenHeZhuangTai) {
        return keHuDingDanService.fanShenHe(shenHeZhuangTai);
    }

    @RequestMapping(value = "/delKeHuDingDanJiLuById", method = RequestMethod.POST)
    @ApiOperation(value = "客户订单记录删除接口", notes = "提供当前页码数与每页显示条数", httpMethod = "post", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "客户订单记录id", required = true, dataType = "int", paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code = 200, message = "请求成功"),
            @ApiResponse(code = 404, message = "找不到页面"),
            @ApiResponse(code = 500, message = "后台服务器错误")
    })
    public R delKeHuDingDanJiLuById(int id) {
        return keHuDingDanService.delKeHuDingDanJiLuById(id);
    }

    @RequestMapping(value = "/updateKeHuDingDanJiLuById",method = RequestMethod.POST)
    @ApiOperation(value = "修改客户订单信息接口",notes = "提供当前页码数与每页显示条数",httpMethod = "post",response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message = "请求成功"),
            @ApiResponse(code=404,message = "找不到页面"),
            @ApiResponse(code=500,message = "后台服务器错误")
    })
    public R updateKeHuDingDanJiLuById(@RequestParam KeHuDingDan keHuDingDan){
        return keHuDingDanService.updateKeHuDingDanJiLuById(keHuDingDan);
    }
}